package idv.arthur.svn;

import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelExec;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.Session;

public class RegenerateRepo {

	public static void main(String[] args) throws JSchException {
		//開始重建此Repository
		JSch jsch = new JSch();
		JSch.setConfig("StrictHostKeyChecking", "no");
		String user = "gamma";
		String url = "http://10.144.97.99/gamma/";
		String pwd = "abcd1234";
		Session session = jsch.getSession(user, url, 22);
		session.setPassword( pwd );
		session.connect();
		String command = "rm -rf gamma;svnadmin create gamma;chown apache.apache gamma -R";
		Channel channel = session.openChannel("exec");
		((ChannelExec) channel).setCommand(command);
		channel.connect();
		if ( channel != null ) { if ( channel.isConnected() ) { channel.disconnect(); } }
		if ( session != null ) { if ( session.isConnected() ) { session.disconnect(); } }

	}

}
